-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Original commits: - 4b1deb3: [gha] better handling of release branches 191e3d2: [nix,debug] run nix bash scripts with traces in debug mode b87a39d: [nix,gha] running only with cachix c3c7f6d: [gha] aligned with nix develop logic 5c50364: [nix] devenv flake 89747e6: [nix] build nix packages in a dedicated flake db8fbce: [nix,gha] nix devenv and github workflow for nuxeo branchesa fa66a4c: VEND-26 applied patch for serialization
- Loading branch information
Showing
22 changed files
with
1,081 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
# GWT Development Environment | ||
|
||
This repository provides a development environment for the Google Web Toolkit (GWT) using Nix flakes. It sets up the necessary tools and dependencies to build and develop GWT applications efficiently. | ||
|
||
## Features | ||
|
||
- **JDK 17**: The development environment includes JDK 17 for Java development. | ||
|
||
- **Apache Ant**: Build tool for automating software build processes. | ||
|
||
- **Maven**: Dependency management and project management tool for Java projects. | ||
|
||
- **GWT Tools**: Includes GWT-specific tools for building and running GWT applications. | ||
|
||
## Getting Started | ||
|
||
### Prerequisites | ||
|
||
- Ensure you have [Nix](https://nixos.org/download.html) installed on your system. | ||
- Enable flakes support by adding the following line to your Nix configuration: | ||
|
||
```bash | ||
experimental-features = nix-command flakes | ||
``` | ||
|
||
## Usage | ||
|
||
### Enter the Development Shell | ||
|
||
To enter the development shell with all necessary dependencies, run: | ||
|
||
```bash | ||
nix develop | ||
``` | ||
|
||
### Build the GWT Application: | ||
You can package your GWT application using the provided build script: | ||
|
||
```bash | ||
nix run .devenv#build-gwt | ||
``` | ||
|
||
### Environment Variables | ||
|
||
- `GWT_VERSION`: Set this environment variable to specify a custom GWT version. | ||
- `GWT_TOOLS`: This variable points to the GWT tools used in the environment. | ||
|
||
### Directory Structure | ||
|
||
- `flake.nix`: The main Nix flake file that defines the development environment and packages. | ||
- `gwt-version.sh`: A script to compute the current GWT version based on the project files. | ||
- `git-rev.sh`: A script to compute the current git revision based on the project files. | ||
- `gwt-packages/flake.nix`: The flake file that defines the packages. | ||
- `gwt-packages/gwt.nix`: The derivation for the GWT package. | ||
- `gwt-packages/gwtTools.nix`: The derivation for the GWT tools package. | ||
|
||
## Contributing | ||
|
||
Contributions are welcome! If you have suggestions or improvements, feel free to open an issue or submit a pull request. | ||
|
||
## License | ||
|
||
This project is licensed under the MIT License - see the LICENSE file for details. | ||
|
||
## Acknowledgments | ||
|
||
Thanks to the Nix community for their support and resources. | ||
Special thanks to the GWT community for providing the tools and documentation that make this project possible. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
#!/usr/bin/env -S bash -e -o pipefail | ||
|
||
[[ -n "${RUNNER_DEBUG}" ]] && | ||
set -x | ||
|
||
root=$(git rev-parse --show-toplevel 2>/dev/null) | ||
if [ -z "$root" ]; then | ||
echo "Error: Not in a Git repository" >&2 | ||
exit 1 | ||
fi | ||
|
||
current_dir=$(pwd) | ||
if [[ "$current_dir" != "$root"* ]]; then | ||
echo "Error: Current directory is not within the Git worktree" >&2 | ||
exit 1 | ||
fi | ||
|
||
if [ ! -d "${root}/.devenv" ]; then | ||
echo "Error: .devenv directory not found in Git root" >&2 | ||
exit 1 | ||
fi | ||
|
||
if [ -z "$GWT_VERSION" ]; then | ||
echo "Error: GWT_VERSION is not set" >&2 | ||
exit 1 | ||
fi | ||
|
||
if [ -z "$GIT_REV" ]; then | ||
echo "Error: GIT_REV is not set" >&2 | ||
exit 1 | ||
fi | ||
|
||
echo "Building GWT ${GWT_VERSION}:${GIT_REV} development distribution package version" | ||
|
||
exec nix build --impure --out-link "${root}/.devenv/dist/result" "${root}/.devenv/dist#gwt" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<project name="custom-macrodefs"> | ||
<macrodef name="gwt.getgitinfo" description="Identifies the GIT info of a workspace"> | ||
<sequential> | ||
<condition property="gwt.gitrev" value="${env.GIT_REV}" else="unknown"> | ||
<and> | ||
<isset property="env.GIT_REV"/> | ||
<not><equals arg1="${env.GIT_REV}" arg2=""/></not> | ||
</and> | ||
</condition> | ||
<exec executable="git" searchpath="true" outputproperty="git.output" resultproperty="git.result" failifexecutionfails="false"> | ||
<arg line="rev-parse --short HEAD"/> | ||
</exec> | ||
<condition property="gwt.gitrev" value="${git.output}" else="${gwt.gitrev}"> | ||
<equals arg1="${git.result}" arg2="0"/> | ||
</condition> | ||
<echo message="Using Git revision: ${gwt.gitrev}"/> | ||
<mkdir dir="${project.build}/sentinels"/> | ||
<property name="filter.sentinel" | ||
location="${project.build}/sentinels/gwt-${gwt.version}-git-${gwt.gitrev}"/> | ||
</sequential> | ||
</macrodef> | ||
</project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
diff --git a/common.ant.xml b/common.ant.xml | ||
index 36a56b488..b61cd36e9 100755 | ||
--- a/common.ant.xml | ||
+++ b/common.ant.xml | ||
@@ -310,13 +310,19 @@ | ||
|
||
<macrodef name="gwt.getgitinfo" description="Identifies the GIT info of a workspace"> | ||
<sequential> | ||
- <exec executable="git" searchpath="true" outputproperty="gwt.gitrev"> | ||
+ <condition property="gwt.gitrev" value="${env.GIT_REV}" else="unknown"> | ||
+ <and> | ||
+ <isset property="env.GIT_REV"/> | ||
+ <not><equals arg1="${env.GIT_REV}" arg2=""/></not> | ||
+ </and> | ||
+ </condition> | ||
+ <exec executable="git" searchpath="true" outputproperty="git.output" resultproperty="git.result" failifexecutionfails="false"> | ||
<arg line="rev-parse --short HEAD"/> | ||
</exec> | ||
- <!-- Generally, filtering requires a sentinel file so that changes to git rev will | ||
- be noticed as invalidating the previously-generated filter output. This property | ||
- names where such a sentinel lives; it is tested with <available/> and created | ||
- with <touch/> --> | ||
+ <condition property="gwt.gitrev" value="${git.output}" else="${gwt.gitrev}"> | ||
+ <equals arg1="${git.result}" arg2="0"/> | ||
+ </condition> | ||
+ <echo message="Using Git revision: ${gwt.gitrev}"/> | ||
<mkdir dir="${project.build}/sentinels"/> | ||
<property name="filter.sentinel" | ||
location="${project.build}/sentinels/gwt-${gwt.version}-git-${gwt.gitrev}"/> |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
{ | ||
description = "GWT and GWT Tools packages"; | ||
|
||
inputs = { | ||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; | ||
flake-utils.url = "github:numtide/flake-utils"; | ||
}; | ||
|
||
outputs = { self, nixpkgs, flake-utils }: | ||
flake-utils.lib.eachDefaultSystem (system: | ||
let | ||
pkgs = import nixpkgs { inherit system; }; | ||
defaultGwtVersion = "0.0.0-dev"; | ||
defaultGitRev = "0000000"; | ||
gwtVersion = builtins.getEnv "GWT_VERSION"; | ||
gitRev = builtins.getEnv "GIT_REV"; | ||
|
||
mkGwtTools = { gwtVersion ? defaultGwtVersion }: | ||
pkgs.callPackage ./tools.nix { inherit gwtVersion; }; | ||
|
||
mkGwt = { gwtVersion ? defaultGwtVersion, gitRev ? defaultGitRev }: | ||
pkgs.callPackage ./gwt.nix { | ||
inherit gwtVersion gitRev; | ||
gwtTools = mkGwtTools { inherit gwtVersion; }; | ||
}; | ||
in | ||
{ | ||
packages = { | ||
gwtTools = mkGwtTools { | ||
gwtVersion = if gwtVersion != "" then gwtVersion else defaultGwtVersion; | ||
}; | ||
gwt = mkGwt { | ||
gwtVersion = if gwtVersion != "" then gwtVersion else defaultGwtVersion; | ||
gitRev = if gitRev != "" then gitRev else defaultGitRev; | ||
}; | ||
}; | ||
|
||
defaultPackage = self.packages.${system}.gwt; | ||
} | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
{ lib, stdenv, unzip, patch, rsync, jdk17, ant, git, which, coreutils, gnused, gnugrep, gwtVersion, gitRev, gwtTools }: | ||
|
||
stdenv.mkDerivation { | ||
pname = "gwt"; | ||
version = gwtVersion; | ||
|
||
src = lib.cleanSourceWith { | ||
filter = name: type: let baseName = baseNameOf (toString name); in | ||
!(lib.hasPrefix "." baseName) || baseName == ".devenv"; | ||
src = ../../.; # Use the parent directory as the source | ||
}; | ||
|
||
sourceRoot = "."; | ||
|
||
nativeBuildInputs = [ unzip git which coreutils gnused gnugrep patch rsync ]; | ||
buildInputs = [ jdk17 ant ]; | ||
|
||
unpackPhase = '' | ||
runHook preUnpack | ||
rsync -av --chmod=u+rw $src/. . | ||
runHook postUnpack | ||
''; | ||
|
||
patchPhase = '' | ||
runHook prePatch | ||
patch -p1 < ${ ./common.ant.xml.patch } | ||
runHook postPatch | ||
''; | ||
|
||
buildPhase = '' | ||
runHook preBuild | ||
export GWT_TOOLS="${lib.escapeShellArg gwtTools}" | ||
export GWT_VERSION="${gwtVersion}" | ||
export GIT_REV="${gitRev}" | ||
echo "Building GWT $${GWT_VERSION}:$${GIT_REV} using GWT_TOOLS=$${GWT_TOOLS}" | ||
env JAVA_HOME="${jdk17}" ant -f build.xml \ | ||
-lib ${gwtTools}/lib -Dgwt.tools=${gwtTools} dist-dev | ||
runHook postBuild | ||
''; | ||
|
||
installPhase = '' | ||
runHook preInstall | ||
mkdir -p $out | ||
rsync -av --progress build/dist/ $out/ | ||
runHook postInstall | ||
''; | ||
|
||
meta = with lib; { | ||
homepage = "http://www.gwtproject.org/"; | ||
description = "Google Web Toolkit"; | ||
license = licenses.asl20; | ||
platforms = platforms.unix; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
{ stdenv, lib, fetchFromGitHub, gwtVersion }: | ||
|
||
stdenv.mkDerivation rec { | ||
pname = "gwtTools"; | ||
version = gwtVersion; | ||
|
||
src = fetchFromGitHub { | ||
owner = "gwtProject"; | ||
repo = "tools"; | ||
rev = "87db1e01191902be60cb12745a6267ae86de540a"; | ||
sha256 = "sha256-y+2j0YucfxTPZmzXrdpWv2ui9ISEXzzIoKgj9JTWo5o="; | ||
}; | ||
|
||
installPhase = '' | ||
runHook preInstall | ||
mkdir -p $out | ||
cp -r $src/* $out/ | ||
runHook postInstall | ||
''; | ||
|
||
meta = { | ||
description = "Toolchain for building GWT ${gwtVersion}"; | ||
homepage = "https://github.com/gwtProject/tools"; | ||
license = lib.licenses.asl20; | ||
}; | ||
} |
Oops, something went wrong.