Skip to content

Commit

Permalink
Merge pull request #114 from ortus-boxlang/development
Browse files Browse the repository at this point in the history
Beta 16
  • Loading branch information
jclausen authored Sep 27, 2024
2 parents d2e3bf9 + e100cb1 commit 6c5c265
Show file tree
Hide file tree
Showing 58 changed files with 1,760 additions and 300 deletions.
13 changes: 12 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ jobs:
permissions:
checks: write
contents: write
packages: write
steps:
- name: Checkout Repository
uses: actions/checkout@v4
Expand Down Expand Up @@ -152,8 +153,18 @@ jobs:
SOURCE_DIR: "build/docs/javadoc"
DEST_DIR: "boxlang/${{ env.VERSION }}"

- name: Publish to Maven Central
# Publish to Maven Central + Github ONLY on Beta/Final Releases
- name: Publish Package (Maven+Github)
if: env.SNAPSHOT == 'false'
run: |
gradle publish --no-daemon --no-parallel
gradle publishToSonatype closeAndReleaseSonatypeStagingRepository
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GPG_KEY: ${{ secrets.GPG_KEY }}
GPG_PASSWORD: ${{ secrets.GPG_PASSWORD }}
MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.MAVEN_PASSWORD }}

- name: Create Github Release
uses: taiki-e/[email protected]
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/snapshot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,5 +70,6 @@ jobs:
permissions:
checks: write
contents: write
packages: write
with:
snapshot: true
42 changes: 40 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ plugins {
// Maven Publisher
id 'maven-publish'
id 'signing'
id 'com.gradleup.nmcp' version "0.0.9"
}

/**
Expand Down Expand Up @@ -106,7 +107,7 @@ dependencies {

// Implementation Dependencies
// https://mvnrepository.com/artifact/commons-io/commons-io
implementation "commons-io:commons-io:2.16.1"
implementation "commons-io:commons-io:2.17.0"
// https://mvnrepository.com/artifact/com.github.javaparser/javaparser-symbol-solver-core
implementation 'com.github.javaparser:javaparser-symbol-solver-core:3.26.2'
// https://mvnrepository.com/artifact/org.apache.commons/commons-lang3
Expand Down Expand Up @@ -315,11 +316,12 @@ publishing {
artifact sourcesJar

// This is the only one sonatype accepts, not ortus.boxlang
// https://central.sonatype.com/
groupId = 'io.boxlang'
artifactId = 'boxlang'
pom {
name = "BoxLang"
description = "BoxLang is a dynamic multi-runtime JVM Language based on fluency and functional constructs. It can be deployed as a standalone language or embedded in your Java applications."
description = "BoxLang is a dynamic multi-runtime JVM Language based on fluency and functional constructs. It can be deployed as a standalone language, embedded in your Java applications, web applications, serverless, android, etc."
url = "https://boxlang.io"
issueManagement {
system = "Jira"
Expand Down Expand Up @@ -393,6 +395,13 @@ publishing {
organization = "Ortus Solutions, Corp"
organizationUrl = "https://www.ortussolutions.com"
}
developer {
id = "ericpeterson"
name = "Eric Peterson"
email = "[email protected]"
organization = "Ortus Solutions, Corp"
organizationUrl = "https://www.ortussolutions.com"
}
}
}
}
Expand All @@ -403,9 +412,38 @@ publishing {
name = 'local-repo'
url = layout.buildDirectory.dir( "repo" )
}
maven {
name = "GitHubPackages"
url = "https://maven.pkg.github.com/ortus-boxlang/boxlang"
credentials {
username = System.getenv( "GITHUB_ACTOR" )
password = System.getenv( "GITHUB_TOKEN" )
}
}
}
}

nmcp {
publishAllProjectsProbablyBreakingProjectIsolation {
username = System.getenv( "MAVEN_USERNAME" ) ?: project.findProperty( "maven_username" )
password = System.getenv( "MAVEN_PASSWORD" ) ?: project.findProperty( "maven_password" )
// publish manually from the portal
//publicationType = "USER_MANAGED"
// or if you want to publish automatically
publicationType = "AUTOMATIC"
}
}

/**
* Digital Signing of assets
*/
signing {
def signingKey = System.getenv("GPG_KEY") ?: project.findProperty("signing.keyId")
def signingPassword = System.getenv("GPG_PASSWORD") ?: project.findProperty("signing.password")
useInMemoryPgpKeys(signingKey, signingPassword)
sign publishing.publications.shadow
}

/**
* Docs are here:
* - https://github.com/harbby/gradle-serviceloader,
Expand Down
4 changes: 2 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#Fri Sep 13 11:16:52 UTC 2024
#Fri Sep 20 12:58:58 UTC 2024
antlrVersion=4.13.1
jdkVersion=21
version=1.0.0-beta15
version=1.0.0-beta16
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ public class CFTranspilerVisitor extends ReplacingBoxVisitor {
private static Key upperCaseKeysKey = Key.of( "upperCaseKeys" );
private static Key forceOutputTrueKey = Key.of( "forceOutputTrue" );
private static Key mergeDocsIntoAnnotationsKey = Key.of( "mergeDocsIntoAnnotations" );
private static Key compatKey = Key.of( "compat" );
private static Key compatKey = Key.of( "compat-cfml" );
private static BoxRuntime runtime = BoxRuntime.getInstance();
private static ModuleService moduleService = runtime.getModuleService();
private boolean isClass = false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,11 @@
package ortus.boxlang.compiler.ast.visitor;

import java.io.File;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.Iterator;
import java.util.List;
import java.util.Optional;

import ortus.boxlang.compiler.ast.BoxClass;
import ortus.boxlang.compiler.ast.BoxExpression;
Expand All @@ -37,16 +39,23 @@
import ortus.boxlang.compiler.ast.statement.BoxReturnType;
import ortus.boxlang.compiler.ast.statement.BoxType;
import ortus.boxlang.compiler.javaboxpiler.transformer.BoxClassTransformer;
import ortus.boxlang.compiler.parser.Parser;
import ortus.boxlang.compiler.parser.ParsingResult;
import ortus.boxlang.runtime.BoxRuntime;
import ortus.boxlang.runtime.context.IBoxContext;
import ortus.boxlang.runtime.dynamic.casters.BooleanCaster;
import ortus.boxlang.runtime.loader.ClassLocator.ClassLocation;
import ortus.boxlang.runtime.loader.resolvers.BoxResolver;
import ortus.boxlang.runtime.scopes.Key;
import ortus.boxlang.runtime.types.Array;
import ortus.boxlang.runtime.types.IStruct;
import ortus.boxlang.runtime.types.Struct;
import ortus.boxlang.runtime.types.exceptions.BoxRuntimeException;
import ortus.boxlang.runtime.types.exceptions.ExpressionException;
import ortus.boxlang.runtime.types.exceptions.ParseException;
import ortus.boxlang.runtime.util.FQN;
import ortus.boxlang.runtime.util.FileSystemUtil;
import ortus.boxlang.runtime.util.ResolvedFilePath;

/**
* I generate metadata for a class or interface based on the AST without needing to instantiate or even compile the code
Expand All @@ -68,8 +77,12 @@ public class ClassMetadataVisitor extends VoidBoxVisitor {

private boolean accessors = false;

private Path sourcePath;

private IBoxContext context;

private BoxResolver BXResolver = BoxResolver.getInstance();

/**
* Constructor
*/
Expand Down Expand Up @@ -107,13 +120,40 @@ public void visit( BoxClass node ) {
} else {
accessors = true;
}
processName( node, meta );
processName( node );
if ( meta.getAsStruct( Key.annotations ).containsKey( Key._EXTENDS ) ) {
meta.put( Key._EXTENDS, processSuper( meta.getAsStruct( Key.annotations ).getAsString( Key._EXTENDS ) ) );
}
super.visit( node );
}

private void processName( BoxNode node, IStruct meta ) {
private IStruct processSuper( String superName ) {
if ( this.sourcePath != null ) {
context.pushTemplate( ResolvedFilePath.of( this.sourcePath ) );
}
Optional<ClassLocation> superLookup = BXResolver.resolve( context, superName, false );
if ( this.sourcePath != null ) {
context.popTemplate();
}
if ( !superLookup.isPresent() ) {
throw new BoxRuntimeException( "Super class [" + superName + "] not found" );
}
String superDiskPath = superLookup.get().path();

ParsingResult result = new Parser().parse( Paths.get( superDiskPath ).toAbsolutePath().toFile() );
if ( !result.isCorrect() ) {
throw new ParseException( result.getIssues(), "" );
}
ClassMetadataVisitor visitor = new ClassMetadataVisitor();
result.getRoot().accept( visitor );

return visitor.getMetadata();
}

private void processName( BoxNode node ) {
if ( node.getPosition() != null && node.getPosition().getSource() != null && node.getPosition().getSource() instanceof SourceFile sf ) {
File sourceFile = sf.getFile();
File sourceFile = sf.getFile();
this.sourcePath = sourceFile.toPath();
var contractedPath = FileSystemUtil.contractPath( context, sourceFile.toString() );
String name = sourceFile.getName().replaceFirst( "[.][^.]+$", "" );
String packageName = FQN.of( Paths.get( contractedPath.relativePath() ) ).getPackageString();
Expand All @@ -130,7 +170,7 @@ public void visit( BoxInterface node ) {
meta.put( Key._NAME, "" );
meta.put( Key.fullname, "" );
meta.put( Key.nameAsKey, Key.of( "" ) );
processName( node, meta );
processName( node );
super.visit( node );
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,8 @@ public Node transform( BoxNode node, TransformerContext context ) throws Illegal
stmt.addStatement( ( Statement ) parseStatement( template3, values ) );
// logger.trace( node.getSourceText() + " -> " + stmt );
addIndex( stmt, node );
// loop over statements in stmt block statement and add index to each statement (the compiler unwraps the block statement so it gets lost)
stmt.getStatements().forEach( s -> addIndex( s, node ) );
return stmt;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@
import ortus.boxlang.parser.antlr.BoxScriptGrammar.ExprPrecedenceContext;
import ortus.boxlang.parser.antlr.BoxScriptGrammar.ExprPrefixContext;
import ortus.boxlang.parser.antlr.BoxScriptGrammar.ExprRelationalContext;
import ortus.boxlang.parser.antlr.BoxScriptGrammar.ExprStatAnonymousFunctionContext;
import ortus.boxlang.parser.antlr.BoxScriptGrammar.ExprStatInvocableContext;
import ortus.boxlang.parser.antlr.BoxScriptGrammar.ExprStaticAccessContext;
import ortus.boxlang.parser.antlr.BoxScriptGrammar.ExprTernaryContext;
Expand Down Expand Up @@ -795,6 +796,11 @@ public BoxNode visitExprStaticAccess( ExprStaticAccessContext ctx ) {
return buildExprStat( ctx );
}

@Override
public BoxNode visitExprStatAnonymousFunction( ExprStatAnonymousFunctionContext ctx ) {
return buildExprStat( ctx );
}

@Override
public BoxNode visitExprNew( ExprNewContext ctx ) {
return buildExprStat( ctx );
Expand Down
6 changes: 6 additions & 0 deletions src/main/java/ortus/boxlang/compiler/toolchain/CFVisitor.java
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@
import ortus.boxlang.parser.antlr.CFGrammar.ExprPrecedenceContext;
import ortus.boxlang.parser.antlr.CFGrammar.ExprPrefixContext;
import ortus.boxlang.parser.antlr.CFGrammar.ExprRelationalContext;
import ortus.boxlang.parser.antlr.CFGrammar.ExprStatAnonymousFunctionContext;
import ortus.boxlang.parser.antlr.CFGrammar.ExprStatInvocableContext;
import ortus.boxlang.parser.antlr.CFGrammar.ExprStaticAccessContext;
import ortus.boxlang.parser.antlr.CFGrammar.ExprTernaryContext;
Expand Down Expand Up @@ -755,6 +756,11 @@ public BoxNode visitExprStaticAccess( ExprStaticAccessContext ctx ) {
return buildExprStat( ctx );
}

@Override
public BoxNode visitExprStatAnonymousFunction( ExprStatAnonymousFunctionContext ctx ) {
return buildExprStat( ctx );
}

@Override
public BoxNode visitExprNew( ExprNewContext ctx ) {
return buildExprStat( ctx );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ public TransactionRollback() {

/**
* Rollback the current transaction and discard all unpersisted queries.
*
* <p>
* Only the changes made since the last <code>transactionSetSavepoint()</code> or <code>transactionCommit()</code> call will be discarded.
* <p>
Expand Down
Loading

0 comments on commit 6c5c265

Please sign in to comment.