Skip to content

Commit 1ae8d30

Browse files
committed
wip javadocs
1 parent c6e7b66 commit 1ae8d30

File tree

1 file changed

+62
-24
lines changed

1 file changed

+62
-24
lines changed

src/cfml/system/util/CompileDSL.cfc

Lines changed: 62 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ component accessors=true {
1818
property name='projectRoot' type="string";
1919
/* folder inside root project where source files reside (.java) */
2020
property name='sourceDirectory' type='string';
21-
property name='classPathDirectory' type='string';
21+
property name='classPaths' type='array';
2222
property name='classOutputDirectory' type='string';
2323
property name='verbose' type='boolean';
2424
property name='encode' type='string';
@@ -33,6 +33,9 @@ component accessors=true {
3333
property name='customManifestParams' type='struct';
3434
property name='resourcePath' type='string';
3535
property name='classTextFilePaths' type='array';
36+
property name='fatJarPaths' type='array';
37+
property name='javaDocDestinationDir' type='string';
38+
property name='useJavaDoc' type='boolean';
3639

3740
//DI
3841
property name="packageService" inject="PackageService";
@@ -63,6 +66,8 @@ component accessors=true {
6366
setCustomManifestParams( {} );
6467
setResourcePath( 'src\main\resources\' );
6568
setClassTextFilePaths(['']);
69+
setJavaDocDestinationDir('javaDocs\main')
70+
setUseJavaDoc(false);
6671
return this;
6772
}
6873

@@ -123,12 +128,6 @@ component accessors=true {
123128
return this;
124129
}
125130

126-
//no longer needed
127-
/* function addToManifest( required string customManifest ) {
128-
setCustomManifest( fileSystemutil.resolvePath( customManifest, getProjectRoot() ) );
129-
return this;
130-
} */
131-
132131
function manifest( required struct customParams ) {
133132
setCustomManifestParams( customParams );
134133
return this;
@@ -138,15 +137,33 @@ component accessors=true {
138137
//if it has a resourcefolder it uses that one
139138
//if its empty then use src\main\resources
140139
setResourcePath( fileSystemutil.resolvePath( resourcesPath, getProjectRoot() ) )
140+
return this;
141+
}
142+
143+
function withJavaDocs(){
144+
return this;
141145
}
142146

143-
function toFatJar( ) {
144-
//if it has a jarFolder use that one
145-
//if it does not have any use java\main\libs
147+
function withClassPath( required any classPath ) {
148+
if( isSimpleValue( arguments.classPath ) ) {
149+
arguments.classPath = listToArray( arguments.classPath, ",", true );
150+
}
151+
arguments.classPath = arguments.classPath.reduce( function( classPaths,cp ) {
152+
return classPaths.append(directorylist( fileSystemutil.resolvePath( cp, getProjectRoot() ), true, 'array', '*jar' ), true);
153+
}, [] );
154+
setClassPaths( arguments.classPath );
155+
return this;
156+
}
146157

147-
//take all the jars in libs folder and unzip them
148-
//add them to the classoutputdirectory with the rest of then
149-
//make the jar
158+
function toFatJar( string jarName='', any includeJars=[] ) {
159+
if( isSimpleValue( arguments.fatJarPathList ) ) {
160+
arguments.fatJarPathList = listToArray( arguments.fatJarPathList, ",", true );
161+
}
162+
arguments.fatJarPathList = arguments.fatJarPathList.map( function( s ) {
163+
return fileSystemutil.resolvePath( arguments.s, getProjectRoot() );
164+
} );
165+
variables.fatJarPaths = arguments.fatJarPathList;
166+
return this;
150167
}
151168

152169
function run() {
@@ -164,9 +181,18 @@ component accessors=true {
164181
job.start( 'update manifest file' );
165182
updateManifestFile();
166183
job.complete();
167-
job.start( 'creating the jar' );
168-
buildJar();
169-
job.complete();
184+
185+
job.start( 'creating the normal jar' );
186+
buildJar();
187+
job.complete();
188+
189+
job.addLog( " len :-> " & len( getFatJarPaths() ) );
190+
if ( len( getFatJarPaths() ) ) {
191+
job.start( 'creating the fat jar' );
192+
//buildFatJar();
193+
job.complete();
194+
}
195+
170196
job.start( 'move resources to jar' );
171197
moveResources();
172198
job.complete();
@@ -183,11 +209,14 @@ component accessors=true {
183209

184210
//shell.printString( " glob-> start... " );
185211
//job.addLog( " glob-> start... " );
212+
var currentProjectRoot = getProjectRoot();
186213

187214
var globber = wirebox.getInstance( 'globber' );
188215
var tempSrcFileName = tempDir & 'temp#createUUID()#.txt';
216+
/* var tempSrcFileName = currentProjectRoot & 'temp#createUUID()#.txt'; */
189217
//job.addLog( " " & serialize( getSourcePaths() ) & " " );
190218

219+
// use only one variable
191220
if( len( getSourcePaths() ) EQ 1 and getSourcePaths()[1] == "" ) {
192221
setSourcePaths( [getSourceDirectory()] );
193222
}
@@ -215,8 +244,13 @@ component accessors=true {
215244

216245
writeTempSourceFile( tempSrcFileName );
217246

247+
var classPathString = "";
248+
if ( len(getClassPaths()) ) {
249+
classPathString = '-cp "#getClassPaths().toList(';')#"';
250+
}
251+
218252
//var javacCommand = 'run ""#getJavaBinFolder()#javac" "@#tempSrcFileName#" -d "#variables.classOutputDirectory#" #variables.compileOptionsString#"';
219-
var javacCommand = 'run ""#getJavaBinFolder()#javac" "@#tempSrcFileName#" -d "#variables.classOutputDirectory#""';
253+
var javacCommand = 'run ""#getJavaBinFolder()#javac" #classPathString# "@#tempSrcFileName#" -d "#variables.classOutputDirectory#""';
220254
//var javacCommand = 'run ""foo why" "bar" -d "test""';
221255

222256
/* if ( getVerbose() ) {
@@ -287,7 +321,9 @@ component accessors=true {
287321
.reduce(( acc, row ) => {
288322
row.directory = replaceNoCase( row.directory, projectRoot, "" );
289323
row.directory = replaceNoCase( row.directory, classOutput, "" );
290-
wipPath = fileSystemutil.normalizeSlashes( row.directory & "/" & row.name );
324+
filePath = row.directory & "\" & row.name;
325+
filePath = replaceNoCase( filePath, classOutput, "" );
326+
wipPath = fileSystemutil.normalizeSlashes( filePath );
291327
wipPath = "-C " & classOutput & " " & wipPath;
292328
finalPath = fileSystemutil.normalizeSlashes( wipPath );
293329
return listappend( acc, finalPath, chr(10) );
@@ -314,8 +350,8 @@ component accessors=true {
314350
var jarName = getJarNameString();
315351
var currentProjectRoot = getProjectRoot();
316352

317-
var tempClassFileName = tempDir & 'temp#createUUID()#.txt';
318-
/* var tempClassFileName = currentProjectRoot & 'temp#createUUID()#.txt'; */
353+
/* var tempClassFileName = tempDir & 'temp#createUUID()#.txt'; */
354+
var tempClassFileName = currentProjectRoot & 'temp#createUUID()#.txt';
319355

320356
var sourceFolders = [];
321357
buildJarSourceFolders = fileSystemutil.resolvePath( variables.classOutputDirectory, getProjectRoot() );
@@ -357,7 +393,9 @@ component accessors=true {
357393
//writeTempSourceFile( tempSrcFileName,['D:\Javatest\greetings\classes\**.class'], ".class" );
358394
writeTempClassFiles( tempClassFileName, sourceFolders, ".class" );
359395

360-
var jarClassString = createClassStringFromClassTextFiles()
396+
var jarClassString = createClassStringFromClassTextFiles();
397+
398+
361399

362400
if( !directoryExists( currentLibsDir ) ) {
363401
directoryCreate( currentLibsDir );
@@ -375,9 +413,9 @@ component accessors=true {
375413
command( j ).run();
376414

377415
} finally {
378-
if ( FileExists( tempClassFileName ) ) {
416+
/* if ( FileExists( tempClassFileName ) ) {
379417
fileDelete( tempClassFileName );
380-
}
418+
} */
381419
}
382420

383421

@@ -596,7 +634,7 @@ component accessors=true {
596634
return jarName;
597635
}
598636

599-
function combiningFatJar() {
637+
function buildFatJar() {
600638
j = "run fat jar ";
601639
shell.printString( " " & j & " " );
602640
//command( j ).run();

0 commit comments

Comments
 (0)