diff --git a/.github/workflows/build-test.yml b/.github/workflows/build-test.yml index 959b30f8f1..f1de048ea4 100644 --- a/.github/workflows/build-test.yml +++ b/.github/workflows/build-test.yml @@ -10,13 +10,18 @@ concurrency: cancel-in-progress: true jobs: - build: - runs-on: ubuntu-latest + testing: + runs-on: ${{ matrix.os }} strategy: matrix: jdk: [ 11, 17 ] - name: Check / Tests (JDK ${{ matrix.jdk }}) + os: [ubuntu-latest, windows-latest] + exclude: + - os: windows-latest + jdk: 11 + + name: Check / Tests -> JDK-${{ matrix.jdk }}/${{ matrix.os }} steps: - name: Checkout uses: actions/checkout@v2 @@ -39,3 +44,39 @@ jobs: - name: Build with Ant working-directory: ./framework run: ant test + + build: + needs: + - testing + runs-on: ubuntu-latest + name: BUILD ${{ github.sha }} + steps: + - name: Checkout + uses: actions/checkout@v2 + with: + # we don't know what commit the last tag was it's safer to get entire repo so previousStableVersion resolves + fetch-depth: 0 + + - name: Set up python 2 + uses: actions/setup-python@v2 + with: + python-version: '2.x' + architecture: 'x64' + + - name: Set up JDK 17 + uses: actions/setup-java@v2 + with: + java-version: 17 + distribution: 'adopt' + + - name: Build with Ant + working-directory: ./framework + run: ant artifact + + - name: ziping artifact + uses: actions/upload-artifact@v2 + with: + name: play-${{ github.sha }} + if-no-files-found: error + path: | + ./framework/dist/* \ No newline at end of file diff --git a/framework/build.xml b/framework/build.xml index ff11f837d0..ed3dcbb399 100644 --- a/framework/build.xml +++ b/framework/build.xml @@ -420,13 +420,21 @@ - + - - - + + + + + + + + + + + diff --git a/framework/pym/play/commands/intellij.py b/framework/pym/play/commands/intellij.py index ff957f700d..a5f1e675dc 100644 --- a/framework/pym/play/commands/intellij.py +++ b/framework/pym/play/commands/intellij.py @@ -24,7 +24,9 @@ def execute(**kargs): shutil.copyfile(os.path.join(play_env["basedir"], 'resources/idea/imlTemplate.xml'), imlFile) cpXML = "" - playHome = play_env["basedir"].replace('\\', '/') + playHomeAlternative = app.toRelative(playHome).replace('\\', '/') + if playHomeAlternative[0:2] == "..": + playHome = "$MODULE_DIR$/" + playHomeAlternative if os.name == 'nt': # On Windows, IntelliJ needs uppercase driveletter @@ -44,7 +46,9 @@ def execute(**kargs): for i, module in enumerate(modules): libpath = os.path.join(module, 'lib') srcpath = os.path.join(module, 'src') - lXML += ' \n \n \n' % (module, os.path.join(module, 'app').replace('\\', '/')) + path = app.toRelative(module).replace('\\', '/') + modulePath = "$MODULE_DIR$/" + path if path[0:2]==".." else module + lXML += ' \n \n \n' % (modulePath, os.path.join(modulePath, 'app').replace('\\', '/')) if os.path.exists(srcpath): msXML += ' \n' % (app.toRelative(srcpath).replace('\\', '/')) if os.path.exists(libpath): @@ -54,13 +58,13 @@ def execute(**kargs): replaceAll(imlFile, r'%MODULE_LINKS%', mlXML) replaceAll(imlFile, r'%MODULE_SOURCES%', msXML) replaceAll(imlFile, r'%MODULE_LIBRARIES%', jdXML) - + iprFile = os.path.join(app.path, application_name + '.ipr') # Only copy/create if missing to avoid overwriting customizations if not os.path.exists(iprFile): shutil.copyfile(os.path.join(play_env["basedir"], 'resources/idea/iprTemplate.xml'), iprFile) replaceAll(iprFile, r'%PROJECT_NAME%', application_name) - + print "~ OK, the application is ready for Intellij Idea" print "~ Use File, Open Project... to open \"" + application_name + ".ipr\"" diff --git a/framework/test-src/play/templates/FastTagsTest.java b/framework/test-src/play/templates/FastTagsTest.java index edf57c38ce..8113178737 100644 --- a/framework/test-src/play/templates/FastTagsTest.java +++ b/framework/test-src/play/templates/FastTagsTest.java @@ -1,45 +1,34 @@ package play.templates; -import groovy.lang.Closure; -import org.junit.After; +import java.io.PrintWriter; +import java.io.StringWriter; +import java.util.HashMap; +import java.util.Map; import org.junit.Before; import org.junit.Test; + +import groovy.lang.Closure; import play.mvc.Http; import play.mvc.Router; import play.mvc.Scope; -import java.io.PrintWriter; -import java.io.StringWriter; -import java.util.HashMap; -import java.util.Map; - import static org.junit.Assert.assertEquals; import static org.mockito.Mockito.mock; public class FastTagsTest { + private static final String LINE_SEPARATOR = System.lineSeparator(); private StringWriter out = new StringWriter(); - final String backupSystemLineBreak = System.getProperty("line.separator"); @Before public void setUp() throws Exception { - //if you render html into out - // and expect results with line breaks - // take into account that your tests will fail on other platforms - // force line.separator be the same on any platform - // or use String.format in expected code with the placeholder '%n' for any expected line separation. - System.setProperty("line.separator","\n"); + Http.Response.current.set(new Http.Response()); Http.Response.current().encoding = "UTF-8"; Scope.Session.current.set(new Scope.Session()); Scope.Session.current().put("___AT", "1234"); } - @After - public void tearDown() throws Exception { - // restore line.separator - System.setProperty("line.separator", backupSystemLineBreak); - } @Test public void _form_simple() throws Exception { @@ -47,16 +36,15 @@ public void _form_simple() throws Exception { actionDefinition.url = "/foo/bar"; actionDefinition.method = "GET"; - Map args = new HashMap() {{ + Map args = new HashMap<>() {{ put("arg", actionDefinition); }}; FastTags._form(args, mock(Closure.class), new PrintWriter(out), null, 0); assertEquals( - "
\n" + - "\n" + - "
", out.toString()); + "
" + LINE_SEPARATOR + + LINE_SEPARATOR + "
", out.toString()); } @Test @@ -65,7 +53,7 @@ public void _form_withName() throws Exception { actionDefinition.url = "/foo/bar"; actionDefinition.method = "GET"; - Map args = new HashMap() {{ + Map args = new HashMap<>() {{ put("arg", actionDefinition); put("name", "my-form"); }}; @@ -73,9 +61,8 @@ public void _form_withName() throws Exception { FastTags._form(args, mock(Closure.class), new PrintWriter(out), null, 0); assertEquals( - "
\n" + - "\n" + - "
", out.toString()); + "
" + + LINE_SEPARATOR + LINE_SEPARATOR + "
", out.toString()); } @Test @@ -84,17 +71,16 @@ public void _form_post() throws Exception { actionDefinition.url = "/foo/bar"; actionDefinition.method = "POST"; - Map args = new HashMap() {{ + Map args = new HashMap<>() {{ put("arg", actionDefinition); }}; FastTags._form(args, mock(Closure.class), new PrintWriter(out), null, 0); assertEquals( - "
\n" + - "\n" + - "\n" + - "
", out.toString()); + "
" + LINE_SEPARATOR + + "" + LINE_SEPARATOR + LINE_SEPARATOR + "
", + out.toString()); } @Test @@ -103,17 +89,16 @@ public void _form_starIsPost() throws Exception { actionDefinition.url = "/foo/bar"; actionDefinition.star = true; - Map args = new HashMap() {{ + Map args = new HashMap<>() {{ put("arg", actionDefinition); }}; FastTags._form(args, mock(Closure.class), new PrintWriter(out), null, 0); assertEquals( - "
\n" + - "\n" + - "\n" + - "
", out.toString()); + "
" + LINE_SEPARATOR + + "" + LINE_SEPARATOR + LINE_SEPARATOR + "
", + out.toString()); } @Test @@ -122,7 +107,7 @@ public void _form_argMethodOverridesActionDefinitionMethod() throws Exception { actionDefinition.url = "/foo/bar"; actionDefinition.method = "GET"; - Map args = new HashMap() {{ + Map args = new HashMap<>() {{ put("arg", actionDefinition); put("method", "POST"); }}; @@ -130,10 +115,9 @@ public void _form_argMethodOverridesActionDefinitionMethod() throws Exception { FastTags._form(args, mock(Closure.class), new PrintWriter(out), null, 0); assertEquals( - "
\n" + - "\n" + - "\n" + - "
", out.toString()); + "
" + LINE_SEPARATOR + + "" + LINE_SEPARATOR + LINE_SEPARATOR + "
", + out.toString()); } @Test @@ -142,7 +126,7 @@ public void _form_customArgs() throws Exception { actionDefinition.url = "/foo/bar"; actionDefinition.method = "GET"; - Map args = new HashMap() {{ + Map args = new HashMap<>() {{ put("arg", actionDefinition); put("data-customer", "12"); }}; @@ -150,9 +134,8 @@ public void _form_customArgs() throws Exception { FastTags._form(args, mock(Closure.class), new PrintWriter(out), null, 0); assertEquals( - "
\n" + - "\n" + - "
", out.toString()); + "
" + + LINE_SEPARATOR + LINE_SEPARATOR + "
", out.toString()); } @Test @@ -161,16 +144,15 @@ public void _form_actionAsActionArg() throws Exception { actionDefinition.url = "/foo/bar"; actionDefinition.method = "GET"; - Map args = new HashMap() {{ + Map args = new HashMap<>() {{ put("action", actionDefinition); }}; FastTags._form(args, mock(Closure.class), new PrintWriter(out), null, 0); assertEquals( - "
\n" + - "\n" + - "
", out.toString()); + "
" + LINE_SEPARATOR + + LINE_SEPARATOR + "
", out.toString()); } @Test @@ -179,7 +161,7 @@ public void _form_customEnctype() throws Exception { actionDefinition.url = "/foo/bar"; actionDefinition.method = "GET"; - Map args = new HashMap() {{ + Map args = new HashMap<>() {{ put("arg", actionDefinition); put("enctype", "xyz"); }}; @@ -187,23 +169,21 @@ public void _form_customEnctype() throws Exception { FastTags._form(args, mock(Closure.class), new PrintWriter(out), null, 0); assertEquals( - "
\n" + - "\n" + - "
", out.toString()); + "
" + LINE_SEPARATOR + LINE_SEPARATOR + "
", + out.toString()); } @Test public void _form_argAsUrlInsteadOfActionDefinition() throws Exception { - Map args = new HashMap() {{ + Map args = new HashMap<>() {{ put("arg", "/foo/bar"); }}; FastTags._form(args, mock(Closure.class), new PrintWriter(out), null, 0); assertEquals( - "
\n" + - "\n" + - "\n" + - "
", out.toString()); + "
" + LINE_SEPARATOR + + "" + LINE_SEPARATOR + LINE_SEPARATOR + "
", + out.toString()); } } \ No newline at end of file